﻿Public Class FrmChonThangBaoCao

    Private _TuThang As Integer
    Public Property TuThang() As Integer
        Get
            Return _TuThang
        End Get
        Set(ByVal value As Integer)
            _TuThang = value
        End Set
    End Property

    Private _DenThang As Integer
    Public Property DenThang() As Integer
        Get
            Return _DenThang
        End Get
        Set(ByVal value As Integer)
            _DenThang = value
        End Set
    End Property

    Private _Nam As Integer
    Public Property Nam() As Integer
        Get
            Return _Nam
        End Get
        Set(ByVal value As Integer)
            _Nam = value
        End Set
    End Property

    Private _labelThoiGian As String
    Public Property labelThoiGian() As String
        Get
            Return _labelThoiGian
        End Get
        Set(ByVal value As String)
            _labelThoiGian = value
        End Set
    End Property

    Private Sub FrmChonThangBaoCao_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        spinTuThang.EditValue = vIntKTThang
        spinDenThang.EditValue = vIntKTThang
        spinNam.EditValue = vIntKTNam
        btnChapNhan.Text = BtnAcceptCaption
        btnThoat.Text = BtnCloseCaption
    End Sub

    Private Sub btnChapNhan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChapNhan.Click
        If CInt(spinTuThang.EditValue) > CInt(spinDenThang.EditValue) Then
            MsgErr("Bạn chọn sai thời gian báo cáo")
        End If
        btnChapNhan.Focus()
        TuThang = CInt(spinTuThang.EditValue)
        DenThang = CInt(spinDenThang.EditValue)
        Nam = CInt(spinNam.EditValue)
        If TuThang = DenThang Then
            labelThoiGian = "Tháng " & TuThang & " năm " & Nam
        ElseIf TuThang < DenThang Then
            labelThoiGian = "Từ tháng " & TuThang & " đến tháng " & DenThang & " năm " & Nam
        End If
        Me.Close()
    End Sub

    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        TuThang = DenThang = Nam = 0
        Me.Close()
    End Sub
End Class